import React, { Component } from 'react';
import   {NavBoxs}  from './style'
import types,{ string,func,element } from 'prop-types'
/* 封装顶部组件 */
class Index extends Component {
    render() {
        return (
            <NavBoxs>
                <div onClick={e => this.props.onLeft(e)}>{this.props.leftText}</div>
                <div>{this.props.title}</div>
                <div onClick={e => this.props.onRight(e)}>{this.props.rightText}</div>
            </NavBoxs>
        );
    }
}
Index.propTypes = {
    title:string,
    leftText:types.oneOfType([string,element]),
    rightText:types.oneOfType([string,element]),
    onLeft:func,
    onRight:func
}
Index.defaultProps = {
    title:'菜谱大全',
    leftText:'',
    rightText:'',
    onLeft:() => {},
    onRight:() => {}
}
export default Index;
